package com.hstc.controller;


import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
public class PromptController {

    @Resource(name = "deepseek")
    private ChatModel deepseekChatModel;
    @Resource(name = "qwen")
    private  ChatModel qwenChatModel;

    @Resource(name = "deepseekChatClient")
    private ChatClient deepseekChatClient;

    @Resource(name = "qwenChatClient")
    private ChatClient qwenChatClient;

    @GetMapping("/deepseekChatClient/stream")
    public Flux<String> deepseekChatClientStreamChat(@RequestParam(name = "msg",defaultValue = "你是谁") String msg){
        return deepseekChatClient.prompt()
                .user(msg)
                .stream()
                .content();
    }

    @GetMapping("/qwenChatClient/stream")
    public Flux<String> qwenChatClientStreamChat(@RequestParam(name = "msg",defaultValue = "你是谁") String msg){
        return qwenChatClient.prompt()
                .user(msg)
                .stream()
                .content();
    }

}
